from flask import Blueprint
from models import ZEProcedureParamModels
from dataclasses import asdict
import json

pro_param_bp = Blueprint("pro_param", __name__, url_prefix="/api")


@pro_param_bp.route("/getAllParam")
def getAllParam():
    TafelProcedureParamType1 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='ATT', value='属性' )
    TafelProcedureParamSpec1 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='B', value='定值' )
    TafelProcedureParamSFZY1 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='XN', value='新能' )
    tableData1 = ZEProcedureParamModels.TafelProcedureParamModel(
        TafelProcedureParamCode='SIZET023',
        TafelProcedureParamDes= '三注',
        TafelProcessProcedure= '包膜测试',
        TafelProcedureParamUnit= 'g',
        TafelProcedureParamType= TafelProcedureParamType1,
        TafelProcedureParamSpec= TafelProcedureParamSpec1,
        TafelProcedureParamSFZY= [TafelProcedureParamSFZY1],
        TafelProcedureParamPlan= '隔离标识 反馈给设备部 ME',
    )
    TafelProcedureParamType2 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='ATT', value='属性' )
    TafelProcedureParamSpec2 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='B', value='定值' )
    TafelProcedureParamSFZY2 = ZEProcedureParamModels.TafelProcedureParamOptionType(id='XN', value='新能' )
    tableData2 = ZEProcedureParamModels.TafelProcedureParamModel(
        TafelProcedureParamCode='SIZET024',
        TafelProcedureParamDes= '黑膜重量',
        TafelProcessProcedure= '包膜测试',
        TafelProcedureParamUnit= 'g',
        TafelProcedureParamType= TafelProcedureParamType2,
        TafelProcedureParamSpec= TafelProcedureParamSpec2,
        TafelProcedureParamSFZY= [TafelProcedureParamSFZY2],
        TafelProcedureParamPlan= '隔离标识 反馈给设备部 ME',
    )
    tableData = [asdict(tableData1),asdict(tableData2)]

    return json.dumps(tableData)
